package com.andrew.demo;

//import org.flywaydb.core.Flyway;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@SpringBootApplication
//@Configuration
//@EnableAutoConfiguration
//@ComponentScan
public class DemoApplication {

    public static void main(String[] args) {


//        String url = "jdbc:mysql://47.103.36.143:3310/demo?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false&allowPublicKeyRetrieval=true";
//        String user = "root";
//        String password = "123456";
//        Flyway flyway = Flyway.configure().dataSource(url, user, password).locations("classpath:db/migration").load();


        // 创建 flyway_schema_history 表
        //flyway.baseline();

        // 删除 flyway_schema_history 表中失败的记录
        //flyway.repair();

        // 检查 sql 文件
        //flyway.validate();

        // 执行数据迁移
        //flyway.migrate();

        // 删除当前 schema 下所有表
        //flyway.clean();


        SpringApplication.run(DemoApplication.class, args);
    }

}
